package com.arnold.test.transformations

import org.apache.spark.{SparkConf, SparkContext}

/**
  * Created by arnold.zhu on 2017/7/18.
  */
object Union {

  def main(args: Array[String]): Unit = {
    val conf = new SparkConf().setMaster("local").setAppName("Spark01Learn")
    val sc = new SparkContext(conf)

    val rdd1 = sc.parallelize(1 to 10)
    val rdd2 = sc.parallelize(10 to 20)

    // 返回一个新的数据集，由原数据集和参数联合而成 将两个RDD进行合并，不去重
    rdd1.union(rdd2).collect.foreach {
      println(_)
    }
  }

}
